package com.deltabot.logging;

import com.deltabot.settings.Client;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Log {

    public static enum LogLevel{
        ERROR, WARNING, INFO, DEBUG, TRACE
    };

    private static String getTime(){
        Calendar cal = Calendar.getInstance();
        cal.getTime();
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
        return sdf.format(cal.getTime());
    }

    public static void write(LogLevel level, String log){
        System.out.println(getTime() + " [" + level.toString() + "] " + log);
    }

    public static void error(String log){
        System.out.println(getTime() + " [ERROR] " + log);
    }

    public static void warning(String log){
        System.out.println(getTime() + " [WARNING] " + log);
    }

    public static void info(String log){
        System.out.println(getTime() + " [INFO] " + log);
    }

    public static void debug(String log){
        if(Client.developerMode){
            System.out.println(getTime() + " [DEBUG] " + log);
        }
    }

    public static void trace(String log){
        System.out.println(getTime() + " [TRACE] " + log);
    }


}
